#include "stdafx.h"
#include "DiffLine.h"

using CollabRC::Bot::DiffLine;

/**
 * @brief Creates a new DiffLine object from the specified
 * removed and added lines.
 * @param removed the line that was removed from the 
 * page, or the empty string "" if there was no removed line
 * @param added the line that was added from the page, or the
 * empty string "" if there was no added line
 * @throws CollabRC::IllegalArgumentException if both
 * removed and added are the empty string ""
 */
DiffLine::DiffLine(const QString& removed, const QString &added):
    m_removed(removed),m_added(added)
{
    if (removed == "" && added == "")
        throw IllegalArgumentException("Attempt to create an empty DiffLine object");
}

    
/**
 * @brief Creates a duplicate DiffLine object from the specified
 * existing DiffLine object
 * @param copy the DiffLine object from which to make a copy
 */
DiffLine::DiffLine(const DiffLine &copy):m_removed(copy.m_removed),m_added(copy.m_added)
{
}

/** @brief Deallocates this DiffLine object and all associated resources */
DiffLine::~DiffLine(void)
{
}

/**
 * @brief Sets the contents of this DiffLine object to the contents
 * of the specified DiffLine object
 * @param rhs the DiffLine object at the right hand side of the operator
 * @return the right hand side of the operator exactly
 */
const DiffLine& DiffLine::operator=(const DiffLine &rhs)
{
    m_added = rhs.m_added;
    m_removed = rhs.m_removed;
    return rhs;
}

/**
 * @brief Gets the removed line specified by this DiffLine object
 * @return the line that was removed. If there was no line removed, then
 * returns the empty string ""
 */
const QString& DiffLine::GetRemovedLine() const
{
    return m_removed;
}

/**
 * @brief Gets the added line specified by this DiffLine object
 * @return the line that was added. If there was no line added, then returns
 * the empty string ""
 */
const QString& DiffLine::GetAddedLine() const
{
    return m_added;
}